package security.channel;

import java.io.IOException;
import java.net.InetAddress;

public interface Channel {
	/**
	 * Sends a Message over that Channel.
	 * 
	 * @param message
	 *            the message to send.
	 */
	void println(String message);

	/**
	 * Reads a line from that Channel (blocking).
	 * 
	 * @return the line from that Channel as a string.
	 * @throws IOException
	 *             if an IO-exception occurs.
	 */
	String readLine() throws IOException;

	/**
	 * Close this channel.
	 * 
	 * @throws IOException
	 *             if any io-exception occurs.
	 * 
	 */
	void close() throws IOException;

	/**
	 * Returns whether the read-half of the socket connection is closed.
	 * 
	 * @return true if the input of the socket has been shutdown
	 */
	boolean isInputShutdown();
	
	/**
	 * Return whether this socket is closed.
	 * 
	 * @return true if the socket has been closed.
	 */
	boolean isClosed();

	/**
	 * Returns the address to which the socket is connected. 
	 * 
	 * @return the InetAddress to which the socket is connected.
	 */
	InetAddress getInetAddress();
}